/**
 * 
 */
package ru.etu.game;

import java.util.Random;

/**
 * @author Alucard
 * @author Neko
 * Класс Врага в игре Танк.
 */
public class Enemy extends Tank {
	@Override
	public Point getNewPosition() {
		think();
		return super.getNewPosition();
	}
	/**
	 * функция - AI 
	 */
	void think(){ 
		Random ran= new Random();
		Direction dir = null;
		switch (ran.nextInt(5)){
			case 0:
				dir = Direction.LEFT;
				setNewPosition(getPoint().minus(new Point(Engine.MINIMAL_MOVE,0,0)));
				break;
			case 1:
				dir = Direction.RIGHT;
				setNewPosition(getPoint().plus(new Point(Engine.MINIMAL_MOVE,0,0)));
				break;
			case 2:
				dir = Direction.UP;
				setNewPosition(getPoint().minus(new Point(0,Engine.MINIMAL_MOVE,0)));
				break;
			case 3:
				dir = Direction.DOWN;
				setNewPosition(getPoint().plus(new Point(0,Engine.MINIMAL_MOVE,0)));
				break;	
			case 4:
				fire();
				break;
		}
		setFront(dir);
	}	
}
